package com.qfedu.dao.impl;

import com.qfedu.bean.User;
import com.qfedu.dao.UserDao;
import com.qfedu.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

public class UserDaoImpl implements UserDao {
    @Override
    public User login(User inputUser) throws Exception {
        return new QueryRunner(JDBCUtils.getDatasource()).query("select * from tb_user where username=? and password=?",
                new BeanHandler<User>(User.class),
                inputUser.getUsername(),
                inputUser.getPassword());
    }
//    @Override
//    public User insert(User inputUser) throws Exception {
//        return new QueryRunner(JDBCUtils.getDatasource()).query("insert into tb_user values(username,password)",
//                new BeanHandler<User>(User.class),
//                inputUser.getUsername(),
//                inputUser.getPassword());
//    }
    }

